<script src="file://<%= ENV['TM_SUPPORT_PATH'] %>/script/shell.js" type='text/javascript'> </script>
<script src="file://<%= ENV['TM_BUNDLE_SUPPORT'] %>/lib/shell.js" type='text/javascript'> </script>
<script>
var image_path = "file:///<%= ENV['TM_SUPPORT_PATH'] %>/images/";

function getData(db, tbl, query, page_size, offset) {
    var res = shell_run("<%= ENV['TM_BUNDLE_SUPPORT'] %>/bin/db_browser.rb", '--mode=frame', shell_join_long_args({database: db, table: tbl, query: query, rows: page_size, offset: offset}));
    document.getElementById("result").innerHTML = res;
    sortables_init();
}
function toggleDatabases(database, tbl, hname, stype, pw, dbuser, dbport, query, page_size, offset) {
    database_name = database.innerText;
    list = document.getElementById('db_' + database_name);
    if (list.getElementsByTagName('li').length == 0) {
        var res = shell_run("<%= ENV['TM_BUNDLE_SUPPORT'] %>/bin/db_browser.rb", '--mode=tables', shell_join_long_args({database: database_name}));
        list.innerHTML = res;
        list.style.display = '';
    } else if (list.style.display != '') {
        list.style.display = '';
    } else {
        list.style.display = 'none';
    }
}

function launchConfig() {
    TextMate.system('"$TM_BUNDLE_SUPPORT"/bin/configure.sh 2>&1', null);
    window.close();
}
</script>
<script src="file://<%= ENV['TM_SUPPORT_PATH'] %>/script/sortable.js" type="text/javascript" charset="utf-8"></script>
